import apiClient from '@/api/apiClient';

import { Entity, ListData, Module, Operation } from '#/entity';

export enum PermissionApi {
  ModulesList = '/security/modules',
  EntityList = '/security/entities',
  OperationList = '/security/operations',
  OperationGroup = '/security/operations/group',
}

const moduleList = (data: any) =>
  apiClient.get<ListData<Module>>({ url: PermissionApi.ModulesList, params: data });

const entityList = (data: any) =>
  apiClient.get<ListData<Entity>>({ url: PermissionApi.EntityList, params: data });

const operationList = (data: any) =>
  apiClient.get<Operation[]>({ url: PermissionApi.OperationList, params: data });

const operationGroup = (data: any) =>
  apiClient.get<Operation[]>({ url: PermissionApi.OperationGroup, params: data });

export default {
  moduleList,
  entityList,
  operationList,
  operationGroup,
};
